/**
 * @Controller 分享
 * */
const Controller = require('egg').Controller;

const shareRule = {
  templateId: 'string', // 模板id
}

class ShareController extends Controller {
  /**
   * @Router POST /api/v1/shares
   * @Request body string templateId 模板Id
   * @Request body string shareId 分享Id
   * @Request header string authorization
   * @Response 200 createShareResponse 响应
   * @Summary 分享
   */
  async create() {
    const { ctx } = this;
    ctx.validate(shareRule, ctx.request.body);
    await ctx.service.share.creatShare(ctx.request.body);
    ctx.body = {
      code: 200,
      success: true,
      data: {},
      msg: '分享成功'
    }
  }

}

module.exports = ShareController;
